<?php

namespace App\Models\Dynamic;

use App\Models\BasicModel;
use App\Models\User;
use App\Models\UserFocus;
use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Likes extends BasicModel
{
    use HasDateTimeFormatter;

    protected $table = 'likes';

    public function upUserNum(Model|\Illuminate\Database\Eloquent\Collection|Lists|array $post)
    {
        User::query()->where('id',$post->user_id)->increment('like_num');
        Lists::query()->where('id',$post->id)->increment('praise_num');
    }


    public function deUserNum(Model|\Illuminate\Database\Eloquent\Collection|Lists|array $post)
    {
        User::query()->where('id',$post->user_id)->decrement('like_num');
        Lists::query()->where('id',$post->id)->decrement('praise_num');
    }

}
